<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="井号" prop="wellNo">
        <el-input
          v-model="queryParams.wellNo"
          placeholder="请输入井号"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="Plus"
          @click="handleAdd"
          v-hasPermi="['helper:wellDetailData:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="Edit"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['helper:wellDetailData:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="Delete"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['helper:wellDetailData:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="Upload"
          @click="handleImport"
          v-hasPermi="['helper:wellDetailData:import']"
        >导入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="Download"
          @click="handleExport"
          v-hasPermi="['helper:wellDetailData:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="wellDetailDataList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键id" align="center" prop="id" v-if="true"/>
      <el-table-column label="井号" align="center" prop="wellNo" />
      <el-table-column label="地层钻深" align="center" prop="formationDrillingDepth" />
      <el-table-column label="井径扩大率" align="center" prop="diameterExpansionRate" />
      <el-table-column label="钻遇漏速" align="center" prop="drillingLeakageRate" />
      <el-table-column label="地面坐标X" align="center" prop="groundCoordinatesX" />
      <el-table-column label="地面坐标Y" align="center" prop="groundCoordinateY" />
      <el-table-column label="地面海拔" align="center" prop="groundElevation" />
      <el-table-column label="地层N22" align="center" prop="formationN22" />
      <el-table-column label="地层N21" align="center" prop="formationN21" />
      <el-table-column label="地层N1" align="center" prop="formationN1" />
      <el-table-column label="地层E32" align="center" prop="formationE32" />
      <el-table-column label="地层E31" align="center" prop="formationE31" />
      <el-table-column label="地层E1+2" align="center" prop="theStratumE1add2" />
      <el-table-column label="在钻地层顶深" align="center" prop="drillingTopFormation" />
      <el-table-column label="在钻地层底深" align="center" prop="drillingButtomFormation" />
      <el-table-column label="垂深" align="center" prop="sag" />
      <el-table-column label="上部套管下深" align="center" prop="upperCasingDepth" />
      <el-table-column label="裸眼段长度" align="center" prop="lengthOpenHoleSection" />
      <el-table-column label="砂岩" align="center" prop="sandstone" />
      <el-table-column label="泥岩" align="center" prop="mudstone" />
      <el-table-column label="灰岩" align="center" prop="limestone" />
      <el-table-column label="砾岩" align="center" prop="conglomerate" />
      <el-table-column label="碳岩" align="center" prop="carbonite" />
      <el-table-column label="白云岩" align="center" prop="dolomite" />
      <el-table-column label="盐岩" align="center" prop="halite" />
      <el-table-column label="石膏岩" align="center" prop="gypsumRock" />
      <el-table-column label="页岩" align="center" prop="shale" />
      <el-table-column label="硅岩" align="center" prop="siliceousRock" />
      <el-table-column label="砂质含量" align="center" prop="sandyContent" />
      <el-table-column label="砂质分布" align="center" prop="sandyDistribution" />
      <el-table-column label="灰质含量" align="center" prop="grayMatterContent" />
      <el-table-column label="灰质分布" align="center" prop="grayMatterDistribution" />
      <el-table-column label="灰质胶结" align="center" prop="limeCementation" />
      <el-table-column label="碳质含量" align="center" prop="carbonContent" />
      <el-table-column label="碳质分布" align="center" prop="carbonDistribution" />
      <el-table-column label="泥质含量" align="center" prop="mudContent" />
      <el-table-column label="泥质分布" align="center" prop="argillaceousDistribution" />
      <el-table-column label="泥质胶结" align="center" prop="argillaceousCementation" />
      <el-table-column label="硅质含量" align="center" prop="siliceousContent" />
      <el-table-column label="硅质分布" align="center" prop="siliceousDistribution" />
      <el-table-column label="硅质胶结" align="center" prop="siliceousCementation" />
      <el-table-column label="白云岩含量" align="center" prop="dolomiteContent" />
      <el-table-column label="云质分布" align="center" prop="cloudMassDistribution" />
      <el-table-column label="云质胶结" align="center" prop="cloudyCementation" />
      <el-table-column label="盐分含量" align="center" prop="saltContent" />
      <el-table-column label="盐分分布" align="center" prop="saltDistribution" />
      <el-table-column label="石膏含量" align="center" prop="gypsumContent" />
      <el-table-column label="石膏分布" align="center" prop="gypsumDistribution" />
      <el-table-column label="硬度" align="center" prop="hardness" />
      <el-table-column label="脆性" align="center" prop="brittleness" />
      <el-table-column label="致密性" align="center" prop="compactness" />
      <el-table-column label="砂岩粗细" align="center" prop="thicknessOfSandstone" />
      <el-table-column label="岩屑形状" align="center" prop="cuttingsShape" />
      <el-table-column label="颜色均匀度" align="center" prop="colorUniformity" />
      <el-table-column label="页理发育" align="center" prop="foliationDevelopment" />
      <el-table-column label="可塑性" align="center" prop="plasticity" />
      <el-table-column label="HCl反应特征" align="center" prop="hclReactionCharacteristics" />
      <el-table-column label="砾石直径" align="center" prop="gravelDiameterMinimum" />
      <el-table-column label="砾石直径" align="center" prop="gravelDiameterMax" />
      <el-table-column label="砾石直径" align="center" prop="gravelDiameterAvg" />
      <el-table-column label="砾石分选性" align="center" prop="gravelSortingAbility" />
      <el-table-column label="是否有荧光" align="center" prop="whetherThereIsFluorescence" />
      <el-table-column label="岩屑颜色深浅" align="center" prop="colorOfCuttings" />
      <el-table-column label="矿物纯度" align="center" prop="mineralPurity" />
      <el-table-column label="吸水性" align="center" prop="hydroscopicity" />
      <el-table-column label="是否染手" align="center" prop="dyeOrNot" />
      <el-table-column label="高岭土含量" align="center" prop="kaolinContent" />
      <el-table-column label="膨润土" align="center" prop="bentonite" />
      <el-table-column label="聚合物" align="center" prop="polymer" />
      <el-table-column label="聚合物快钻" align="center" prop="polymerQuickDrill" />
      <el-table-column label="盐水聚合物" align="center" prop="brinePolymer" />
      <el-table-column label="盐水聚磺" align="center" prop="saltPolysulfonate" />
      <el-table-column label="聚磺" align="center" prop="polysulfone" />
      <el-table-column label="有机盐" align="center" prop="organicSalt" />
      <el-table-column label="肢基有机盐" align="center" prop="extremalOrganicSalt" />
      <el-table-column label="有机盐聚磺" align="center" prop="organicSaltPolysulfonate" />
      <el-table-column label="钾聚磺" align="center" prop="potassiumPolysulfone" />
      <el-table-column label="白油基" align="center" prop="whiteOilBase" />
      <el-table-column label="钻井液密度" align="center" prop="drillingFluidDensity" />
      <el-table-column label="漏斗黏度" align="center" prop="funnelViscosity" />
      <el-table-column label="θ3" align="center" prop="threeTheta" />
      <el-table-column label="θ300" align="center" prop="threeHundredTheta" />
      <el-table-column label="θ600" align="center" prop="sixHundredTheta" />
      <el-table-column label="初切" align="center" prop="firstCut" />
      <el-table-column label="终切" align="center" prop="finalCut" />
      <el-table-column label="井口返液温度" align="center" prop="wellheadReturnTemperature" />
      <el-table-column label="含砂量" align="center" prop="sandContent" />
      <el-table-column label="pH值" align="center" prop="phValue" />
      <el-table-column label="中压失水" align="center" prop="mediumPressureLossWater" />
      <el-table-column label="高温失水" align="center" prop="highTemperatureLossWater" />
      <el-table-column label="中压泥饼" align="center" prop="mediumPressureMudCake" />
      <el-table-column label="高温泥饼" align="center" prop="highTemperatureMudCake" />
      <el-table-column label="中压摩擦系数" align="center" prop="mediumFrictionCoefficient" />
      <el-table-column label="MBT含量" align="center" prop="mbtContent" />
      <el-table-column label="Cl-含量" align="center" prop="clContent" />
      <el-table-column label="Ca+含量" align="center" prop="caContent" />
      <el-table-column label="钻头直径" align="center" prop="bitDiameter" />
      <el-table-column label="喷嘴数量" align="center" prop="nozzleNumber" />
      <el-table-column label="单个喷嘴直径" align="center" prop="individualNozzleDiameter" />
      <el-table-column label="钻头转速" align="center" prop="bitSpeed" />
      <el-table-column label="排量缸径" align="center" prop="displacementBore" />
      <el-table-column label="排量冲速" align="center" prop="dischargeImpulseRate" />
      <el-table-column label="立管泵压" align="center" prop="riserPumpPressure" />
      <el-table-column label="钻头压降" align="center" prop="bitPressureDrop" />
      <el-table-column label="环空压耗" align="center" prop="annularPressureLoss" />
      <el-table-column label="喷射速度" align="center" prop="injectionVelocity" />
      <el-table-column label="钻杆上返速度" align="center" prop="speedOfPipeReturn" />
      <el-table-column label="钻头水功率" align="center" prop="bitWaterPower" />
      <el-table-column label="比水功率" align="center" prop="specificWaterPower" />
      <el-table-column label="单米时间" align="center" prop="oneMeterTime" />
      <el-table-column label="实时钻压" align="center" prop="realWeightOnBit" />
      <el-table-column label="实时转速" align="center" prop="realtimeSpeed" />
      <el-table-column label="实际排量" align="center" prop="actualDischarge" />
      <el-table-column label="实时泵压" align="center" prop="realtimePumpPressure" />
      <el-table-column label="E坐标" align="center" prop="eCoordinate" />
      <el-table-column label="N坐标" align="center" prop="nCoordinate" />
      <el-table-column label="井斜角" align="center" prop="holeDriftAngle" />
      <el-table-column label="方位角" align="center" prop="azimuthAngle" />
      <el-table-column label="全角变化率" align="center" prop="fullAngularRateChange" />
      <el-table-column label="井斜变化率" align="center" prop="rateOfDeviationChange" />
      <el-table-column label="方位变化率" align="center" prop="bearingRate" />
      <el-table-column label="平均井径" align="center" prop="meanDiameter" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template #default="scope">
              <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['helper:wellDetailData:edit']">修改</el-button>
              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['helper:wellDetailData:remove']">删除</el-button>
          </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改钻井-详细信息对话框 -->
    <el-dialog :title="title" v-model="open" width="500px" append-to-body>
      <el-form ref="wellDetailDataRef" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="井号" prop="wellNo">
          <el-input v-model="form.wellNo" placeholder="请输入井号" />
        </el-form-item>
        <el-form-item label="地层钻深" prop="formationDrillingDepth">
          <el-input v-model="form.formationDrillingDepth" placeholder="请输入地层钻深" />
        </el-form-item>
        <el-form-item label="井径扩大率" prop="diameterExpansionRate">
          <el-input v-model="form.diameterExpansionRate" placeholder="请输入井径扩大率" />
        </el-form-item>
        <el-form-item label="钻遇漏速" prop="drillingLeakageRate">
          <el-input v-model="form.drillingLeakageRate" placeholder="请输入钻遇漏速" />
        </el-form-item>
        <el-form-item label="地面坐标X" prop="groundCoordinatesX">
          <el-input v-model="form.groundCoordinatesX" placeholder="请输入地面坐标X" />
        </el-form-item>
        <el-form-item label="地面坐标Y" prop="groundCoordinateY">
          <el-input v-model="form.groundCoordinateY" placeholder="请输入地面坐标Y" />
        </el-form-item>
        <el-form-item label="地面海拔" prop="groundElevation">
          <el-input v-model="form.groundElevation" placeholder="请输入地面海拔" />
        </el-form-item>
        <el-form-item label="地层N22" prop="formationN22">
          <el-input v-model="form.formationN22" placeholder="请输入地层N22" />
        </el-form-item>
        <el-form-item label="地层N21" prop="formationN21">
          <el-input v-model="form.formationN21" placeholder="请输入地层N21" />
        </el-form-item>
        <el-form-item label="地层N1" prop="formationN1">
          <el-input v-model="form.formationN1" placeholder="请输入地层N1" />
        </el-form-item>
        <el-form-item label="地层E32" prop="formationE32">
          <el-input v-model="form.formationE32" placeholder="请输入地层E32" />
        </el-form-item>
        <el-form-item label="地层E31" prop="formationE31">
          <el-input v-model="form.formationE31" placeholder="请输入地层E31" />
        </el-form-item>
        <el-form-item label="地层E1+2" prop="theStratumE1add2">
          <el-input v-model="form.theStratumE1add2" placeholder="请输入地层E1+2" />
        </el-form-item>
        <el-form-item label="在钻地层顶深" prop="drillingTopFormation">
          <el-input v-model="form.drillingTopFormation" placeholder="请输入在钻地层顶深" />
        </el-form-item>
        <el-form-item label="在钻地层底深" prop="drillingButtomFormation">
          <el-input v-model="form.drillingButtomFormation" placeholder="请输入在钻地层底深" />
        </el-form-item>
        <el-form-item label="垂深" prop="sag">
          <el-input v-model="form.sag" placeholder="请输入垂深" />
        </el-form-item>
        <el-form-item label="上部套管下深" prop="upperCasingDepth">
          <el-input v-model="form.upperCasingDepth" placeholder="请输入上部套管下深" />
        </el-form-item>
        <el-form-item label="裸眼段长度" prop="lengthOpenHoleSection">
          <el-input v-model="form.lengthOpenHoleSection" placeholder="请输入裸眼段长度" />
        </el-form-item>
        <el-form-item label="砂岩" prop="sandstone">
          <el-input v-model="form.sandstone" placeholder="请输入砂岩" />
        </el-form-item>
        <el-form-item label="泥岩" prop="mudstone">
          <el-input v-model="form.mudstone" placeholder="请输入泥岩" />
        </el-form-item>
        <el-form-item label="灰岩" prop="limestone">
          <el-input v-model="form.limestone" placeholder="请输入灰岩" />
        </el-form-item>
        <el-form-item label="砾岩" prop="conglomerate">
          <el-input v-model="form.conglomerate" placeholder="请输入砾岩" />
        </el-form-item>
        <el-form-item label="碳岩" prop="carbonite">
          <el-input v-model="form.carbonite" placeholder="请输入碳岩" />
        </el-form-item>
        <el-form-item label="白云岩" prop="dolomite">
          <el-input v-model="form.dolomite" placeholder="请输入白云岩" />
        </el-form-item>
        <el-form-item label="盐岩" prop="halite">
          <el-input v-model="form.halite" placeholder="请输入盐岩" />
        </el-form-item>
        <el-form-item label="石膏岩" prop="gypsumRock">
          <el-input v-model="form.gypsumRock" placeholder="请输入石膏岩" />
        </el-form-item>
        <el-form-item label="页岩" prop="shale">
          <el-input v-model="form.shale" placeholder="请输入页岩" />
        </el-form-item>
        <el-form-item label="硅岩" prop="siliceousRock">
          <el-input v-model="form.siliceousRock" placeholder="请输入硅岩" />
        </el-form-item>
        <el-form-item label="砂质含量">
          <editor v-model="form.sandyContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="砂质分布" prop="sandyDistribution">
          <el-input v-model="form.sandyDistribution" placeholder="请输入砂质分布" />
        </el-form-item>
        <el-form-item label="灰质含量">
          <editor v-model="form.grayMatterContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="灰质分布" prop="grayMatterDistribution">
          <el-input v-model="form.grayMatterDistribution" placeholder="请输入灰质分布" />
        </el-form-item>
        <el-form-item label="灰质胶结" prop="limeCementation">
          <el-input v-model="form.limeCementation" placeholder="请输入灰质胶结" />
        </el-form-item>
        <el-form-item label="碳质含量">
          <editor v-model="form.carbonContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="碳质分布" prop="carbonDistribution">
          <el-input v-model="form.carbonDistribution" placeholder="请输入碳质分布" />
        </el-form-item>
        <el-form-item label="泥质含量">
          <editor v-model="form.mudContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="泥质分布" prop="argillaceousDistribution">
          <el-input v-model="form.argillaceousDistribution" placeholder="请输入泥质分布" />
        </el-form-item>
        <el-form-item label="泥质胶结" prop="argillaceousCementation">
          <el-input v-model="form.argillaceousCementation" placeholder="请输入泥质胶结" />
        </el-form-item>
        <el-form-item label="硅质含量">
          <editor v-model="form.siliceousContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="硅质分布" prop="siliceousDistribution">
          <el-input v-model="form.siliceousDistribution" placeholder="请输入硅质分布" />
        </el-form-item>
        <el-form-item label="硅质胶结" prop="siliceousCementation">
          <el-input v-model="form.siliceousCementation" placeholder="请输入硅质胶结" />
        </el-form-item>
        <el-form-item label="白云岩含量">
          <editor v-model="form.dolomiteContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="云质分布" prop="cloudMassDistribution">
          <el-input v-model="form.cloudMassDistribution" placeholder="请输入云质分布" />
        </el-form-item>
        <el-form-item label="云质胶结" prop="cloudyCementation">
          <el-input v-model="form.cloudyCementation" placeholder="请输入云质胶结" />
        </el-form-item>
        <el-form-item label="盐分含量">
          <editor v-model="form.saltContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="盐分分布" prop="saltDistribution">
          <el-input v-model="form.saltDistribution" placeholder="请输入盐分分布" />
        </el-form-item>
        <el-form-item label="石膏含量">
          <editor v-model="form.gypsumContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="石膏分布" prop="gypsumDistribution">
          <el-input v-model="form.gypsumDistribution" placeholder="请输入石膏分布" />
        </el-form-item>
        <el-form-item label="硬度" prop="hardness">
          <el-input v-model="form.hardness" placeholder="请输入硬度" />
        </el-form-item>
        <el-form-item label="脆性" prop="brittleness">
          <el-input v-model="form.brittleness" placeholder="请输入脆性" />
        </el-form-item>
        <el-form-item label="致密性" prop="compactness">
          <el-input v-model="form.compactness" placeholder="请输入致密性" />
        </el-form-item>
        <el-form-item label="砂岩粗细" prop="thicknessOfSandstone">
          <el-input v-model="form.thicknessOfSandstone" placeholder="请输入砂岩粗细" />
        </el-form-item>
        <el-form-item label="岩屑形状" prop="cuttingsShape">
          <el-input v-model="form.cuttingsShape" placeholder="请输入岩屑形状" />
        </el-form-item>
        <el-form-item label="颜色均匀度" prop="colorUniformity">
          <el-input v-model="form.colorUniformity" placeholder="请输入颜色均匀度" />
        </el-form-item>
        <el-form-item label="页理发育" prop="foliationDevelopment">
          <el-input v-model="form.foliationDevelopment" placeholder="请输入页理发育" />
        </el-form-item>
        <el-form-item label="可塑性" prop="plasticity">
          <el-input v-model="form.plasticity" placeholder="请输入可塑性" />
        </el-form-item>
        <el-form-item label="HCl反应特征" prop="hclReactionCharacteristics">
          <el-input v-model="form.hclReactionCharacteristics" placeholder="请输入HCl反应特征" />
        </el-form-item>
        <el-form-item label="砾石直径" prop="gravelDiameterMinimum">
          <el-input v-model="form.gravelDiameterMinimum" placeholder="请输入砾石直径" />
        </el-form-item>
        <el-form-item label="砾石直径" prop="gravelDiameterMax">
          <el-input v-model="form.gravelDiameterMax" placeholder="请输入砾石直径" />
        </el-form-item>
        <el-form-item label="砾石直径" prop="gravelDiameterAvg">
          <el-input v-model="form.gravelDiameterAvg" placeholder="请输入砾石直径" />
        </el-form-item>
        <el-form-item label="砾石分选性" prop="gravelSortingAbility">
          <el-input v-model="form.gravelSortingAbility" placeholder="请输入砾石分选性" />
        </el-form-item>
        <el-form-item label="是否有荧光" prop="whetherThereIsFluorescence">
          <el-input v-model="form.whetherThereIsFluorescence" placeholder="请输入是否有荧光" />
        </el-form-item>
        <el-form-item label="岩屑颜色深浅" prop="colorOfCuttings">
          <el-input v-model="form.colorOfCuttings" placeholder="请输入岩屑颜色深浅" />
        </el-form-item>
        <el-form-item label="矿物纯度" prop="mineralPurity">
          <el-input v-model="form.mineralPurity" placeholder="请输入矿物纯度" />
        </el-form-item>
        <el-form-item label="吸水性" prop="hydroscopicity">
          <el-input v-model="form.hydroscopicity" placeholder="请输入吸水性" />
        </el-form-item>
        <el-form-item label="是否染手" prop="dyeOrNot">
          <el-input v-model="form.dyeOrNot" placeholder="请输入是否染手" />
        </el-form-item>
        <el-form-item label="高岭土含量">
          <editor v-model="form.kaolinContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="膨润土" prop="bentonite">
          <el-input v-model="form.bentonite" placeholder="请输入膨润土" />
        </el-form-item>
        <el-form-item label="聚合物" prop="polymer">
          <el-input v-model="form.polymer" placeholder="请输入聚合物" />
        </el-form-item>
        <el-form-item label="聚合物快钻" prop="polymerQuickDrill">
          <el-input v-model="form.polymerQuickDrill" placeholder="请输入聚合物快钻" />
        </el-form-item>
        <el-form-item label="盐水聚合物" prop="brinePolymer">
          <el-input v-model="form.brinePolymer" placeholder="请输入盐水聚合物" />
        </el-form-item>
        <el-form-item label="盐水聚磺" prop="saltPolysulfonate">
          <el-input v-model="form.saltPolysulfonate" placeholder="请输入盐水聚磺" />
        </el-form-item>
        <el-form-item label="聚磺" prop="polysulfone">
          <el-input v-model="form.polysulfone" placeholder="请输入聚磺" />
        </el-form-item>
        <el-form-item label="有机盐" prop="organicSalt">
          <el-input v-model="form.organicSalt" placeholder="请输入有机盐" />
        </el-form-item>
        <el-form-item label="肢基有机盐" prop="extremalOrganicSalt">
          <el-input v-model="form.extremalOrganicSalt" placeholder="请输入肢基有机盐" />
        </el-form-item>
        <el-form-item label="有机盐聚磺" prop="organicSaltPolysulfonate">
          <el-input v-model="form.organicSaltPolysulfonate" placeholder="请输入有机盐聚磺" />
        </el-form-item>
        <el-form-item label="钾聚磺" prop="potassiumPolysulfone">
          <el-input v-model="form.potassiumPolysulfone" placeholder="请输入钾聚磺" />
        </el-form-item>
        <el-form-item label="白油基" prop="whiteOilBase">
          <el-input v-model="form.whiteOilBase" placeholder="请输入白油基" />
        </el-form-item>
        <el-form-item label="钻井液密度" prop="drillingFluidDensity">
          <el-input v-model="form.drillingFluidDensity" placeholder="请输入钻井液密度" />
        </el-form-item>
        <el-form-item label="漏斗黏度" prop="funnelViscosity">
          <el-input v-model="form.funnelViscosity" placeholder="请输入漏斗黏度" />
        </el-form-item>
        <el-form-item label="θ3" prop="threeTheta">
          <el-input v-model="form.threeTheta" placeholder="请输入θ3" />
        </el-form-item>
        <el-form-item label="θ300" prop="threeHundredTheta">
          <el-input v-model="form.threeHundredTheta" placeholder="请输入θ300" />
        </el-form-item>
        <el-form-item label="θ600" prop="sixHundredTheta">
          <el-input v-model="form.sixHundredTheta" placeholder="请输入θ600" />
        </el-form-item>
        <el-form-item label="初切" prop="firstCut">
          <el-input v-model="form.firstCut" placeholder="请输入初切" />
        </el-form-item>
        <el-form-item label="终切" prop="finalCut">
          <el-input v-model="form.finalCut" placeholder="请输入终切" />
        </el-form-item>
        <el-form-item label="井口返液温度" prop="wellheadReturnTemperature">
          <el-input v-model="form.wellheadReturnTemperature" placeholder="请输入井口返液温度" />
        </el-form-item>
        <el-form-item label="含砂量">
          <editor v-model="form.sandContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="pH值" prop="phValue">
          <el-input v-model="form.phValue" placeholder="请输入pH值" />
        </el-form-item>
        <el-form-item label="中压失水" prop="mediumPressureLossWater">
          <el-input v-model="form.mediumPressureLossWater" placeholder="请输入中压失水" />
        </el-form-item>
        <el-form-item label="高温失水" prop="highTemperatureLossWater">
          <el-input v-model="form.highTemperatureLossWater" placeholder="请输入高温失水" />
        </el-form-item>
        <el-form-item label="中压泥饼" prop="mediumPressureMudCake">
          <el-input v-model="form.mediumPressureMudCake" placeholder="请输入中压泥饼" />
        </el-form-item>
        <el-form-item label="高温泥饼" prop="highTemperatureMudCake">
          <el-input v-model="form.highTemperatureMudCake" placeholder="请输入高温泥饼" />
        </el-form-item>
        <el-form-item label="中压摩擦系数" prop="mediumFrictionCoefficient">
          <el-input v-model="form.mediumFrictionCoefficient" placeholder="请输入中压摩擦系数" />
        </el-form-item>
        <el-form-item label="MBT含量">
          <editor v-model="form.mbtContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="Cl-含量">
          <editor v-model="form.clContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="Ca+含量">
          <editor v-model="form.caContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="钻头直径" prop="bitDiameter">
          <el-input v-model="form.bitDiameter" placeholder="请输入钻头直径" />
        </el-form-item>
        <el-form-item label="喷嘴数量" prop="nozzleNumber">
          <el-input v-model="form.nozzleNumber" placeholder="请输入喷嘴数量" />
        </el-form-item>
        <el-form-item label="单个喷嘴直径" prop="individualNozzleDiameter">
          <el-input v-model="form.individualNozzleDiameter" placeholder="请输入单个喷嘴直径" />
        </el-form-item>
        <el-form-item label="钻头转速" prop="bitSpeed">
          <el-input v-model="form.bitSpeed" placeholder="请输入钻头转速" />
        </el-form-item>
        <el-form-item label="排量缸径" prop="displacementBore">
          <el-input v-model="form.displacementBore" placeholder="请输入排量缸径" />
        </el-form-item>
        <el-form-item label="排量冲速" prop="dischargeImpulseRate">
          <el-input v-model="form.dischargeImpulseRate" placeholder="请输入排量冲速" />
        </el-form-item>
        <el-form-item label="立管泵压" prop="riserPumpPressure">
          <el-input v-model="form.riserPumpPressure" placeholder="请输入立管泵压" />
        </el-form-item>
        <el-form-item label="钻头压降" prop="bitPressureDrop">
          <el-input v-model="form.bitPressureDrop" placeholder="请输入钻头压降" />
        </el-form-item>
        <el-form-item label="环空压耗" prop="annularPressureLoss">
          <el-input v-model="form.annularPressureLoss" placeholder="请输入环空压耗" />
        </el-form-item>
        <el-form-item label="喷射速度" prop="injectionVelocity">
          <el-input v-model="form.injectionVelocity" placeholder="请输入喷射速度" />
        </el-form-item>
        <el-form-item label="钻杆上返速度" prop="speedOfPipeReturn">
          <el-input v-model="form.speedOfPipeReturn" placeholder="请输入钻杆上返速度" />
        </el-form-item>
        <el-form-item label="钻头水功率" prop="bitWaterPower">
          <el-input v-model="form.bitWaterPower" placeholder="请输入钻头水功率" />
        </el-form-item>
        <el-form-item label="比水功率" prop="specificWaterPower">
          <el-input v-model="form.specificWaterPower" placeholder="请输入比水功率" />
        </el-form-item>
        <el-form-item label="单米时间" prop="oneMeterTime">
          <el-input v-model="form.oneMeterTime" placeholder="请输入单米时间" />
        </el-form-item>
        <el-form-item label="实时钻压" prop="realWeightOnBit">
          <el-input v-model="form.realWeightOnBit" placeholder="请输入实时钻压" />
        </el-form-item>
        <el-form-item label="实时转速" prop="realtimeSpeed">
          <el-input v-model="form.realtimeSpeed" placeholder="请输入实时转速" />
        </el-form-item>
        <el-form-item label="实际排量" prop="actualDischarge">
          <el-input v-model="form.actualDischarge" placeholder="请输入实际排量" />
        </el-form-item>
        <el-form-item label="实时泵压" prop="realtimePumpPressure">
          <el-input v-model="form.realtimePumpPressure" placeholder="请输入实时泵压" />
        </el-form-item>
        <el-form-item label="E坐标" prop="eCoordinate">
          <el-input v-model="form.eCoordinate" placeholder="请输入E坐标" />
        </el-form-item>
        <el-form-item label="N坐标" prop="nCoordinate">
          <el-input v-model="form.nCoordinate" placeholder="请输入N坐标" />
        </el-form-item>
        <el-form-item label="井斜角" prop="holeDriftAngle">
          <el-input v-model="form.holeDriftAngle" placeholder="请输入井斜角" />
        </el-form-item>
        <el-form-item label="方位角" prop="azimuthAngle">
          <el-input v-model="form.azimuthAngle" placeholder="请输入方位角" />
        </el-form-item>
        <el-form-item label="全角变化率" prop="fullAngularRateChange">
          <el-input v-model="form.fullAngularRateChange" placeholder="请输入全角变化率" />
        </el-form-item>
        <el-form-item label="井斜变化率" prop="rateOfDeviationChange">
          <el-input v-model="form.rateOfDeviationChange" placeholder="请输入井斜变化率" />
        </el-form-item>
        <el-form-item label="方位变化率" prop="bearingRate">
          <el-input v-model="form.bearingRate" placeholder="请输入方位变化率" />
        </el-form-item>
        <el-form-item label="平均井径" prop="meanDiameter">
          <el-input v-model="form.meanDiameter" placeholder="请输入平均井径" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <!-- 数据导入对话框 -->
    <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
      <el-upload
        ref="uploadRef"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <template #tip>
          <div class="el-upload__tip text-center">
            <span>仅允许导入xls、xlsx格式文件。</span>
            <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
          </div>
        </template>
      </el-upload>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitFileForm">确 定</el-button>
          <el-button @click="upload.open = false">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="WellDetailData">
import { getToken } from "@/utils/auth";
import { listWellDetailData, getWellDetailData, delWellDetailData, addWellDetailData, updateWellDetailData } from "@/api/loss/wellDetailData";

const { proxy } = getCurrentInstance();

const wellDetailDataList = ref([]);
const open = ref(false);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");

/*** 数据导入参数 */
const upload = reactive({
  // 是否显示弹出层（用户导入）
  open: false,
  // 弹出层标题（用户导入）
  title: "",
  // 是否禁用上传
  isUploading: false,
  // 是否更新已经存在的用户数据
  updateSupport: 0,
  // 设置上传的请求头部
  headers: { Authorization: "Bearer " + getToken() },
  // 上传的地址
  url: import.meta.env.VITE_APP_BASE_API + "/helper/wellDetailData/importData"
});
const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    wellNo: undefined,
  },
  rules: {
    id: [
      { required: true, message: "主键id不能为空", trigger: "blur" }
    ],
    wellNo: [
      { required: true, message: "井号不能为空", trigger: "blur" }
    ],
  }
});

const { queryParams, form, rules } = toRefs(data);

/** 查询钻井-详细信息列表 */
function getList() {
  loading.value = true;
  listWellDetailData(queryParams.value).then(response => {
    wellDetailDataList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}

// 取消按钮
function cancel() {
  open.value = false;
  reset();
}

// 表单重置
function reset() {
  form.value = {
    id: null,
    wellNo: null,
    formationDrillingDepth: null,
    diameterExpansionRate: null,
    drillingLeakageRate: null,
    groundCoordinatesX: null,
    groundCoordinateY: null,
    groundElevation: null,
    formationN22: null,
    formationN21: null,
    formationN1: null,
    formationE32: null,
    formationE31: null,
    theStratumE1add2: null,
    drillingTopFormation: null,
    drillingButtomFormation: null,
    sag: null,
    upperCasingDepth: null,
    lengthOpenHoleSection: null,
    sandstone: null,
    mudstone: null,
    limestone: null,
    conglomerate: null,
    carbonite: null,
    dolomite: null,
    halite: null,
    gypsumRock: null,
    shale: null,
    siliceousRock: null,
    sandyContent: null,
    sandyDistribution: null,
    grayMatterContent: null,
    grayMatterDistribution: null,
    limeCementation: null,
    carbonContent: null,
    carbonDistribution: null,
    mudContent: null,
    argillaceousDistribution: null,
    argillaceousCementation: null,
    siliceousContent: null,
    siliceousDistribution: null,
    siliceousCementation: null,
    dolomiteContent: null,
    cloudMassDistribution: null,
    cloudyCementation: null,
    saltContent: null,
    saltDistribution: null,
    gypsumContent: null,
    gypsumDistribution: null,
    hardness: null,
    brittleness: null,
    compactness: null,
    thicknessOfSandstone: null,
    cuttingsShape: null,
    colorUniformity: null,
    foliationDevelopment: null,
    plasticity: null,
    hclReactionCharacteristics: null,
    gravelDiameterMinimum: null,
    gravelDiameterMax: null,
    gravelDiameterAvg: null,
    gravelSortingAbility: null,
    whetherThereIsFluorescence: null,
    colorOfCuttings: null,
    mineralPurity: null,
    hydroscopicity: null,
    dyeOrNot: null,
    kaolinContent: null,
    bentonite: null,
    polymer: null,
    polymerQuickDrill: null,
    brinePolymer: null,
    saltPolysulfonate: null,
    polysulfone: null,
    organicSalt: null,
    extremalOrganicSalt: null,
    organicSaltPolysulfonate: null,
    potassiumPolysulfone: null,
    whiteOilBase: null,
    drillingFluidDensity: null,
    funnelViscosity: null,
    threeTheta: null,
    threeHundredTheta: null,
    sixHundredTheta: null,
    firstCut: null,
    finalCut: null,
    wellheadReturnTemperature: null,
    sandContent: null,
    phValue: null,
    mediumPressureLossWater: null,
    highTemperatureLossWater: null,
    mediumPressureMudCake: null,
    highTemperatureMudCake: null,
    mediumFrictionCoefficient: null,
    mbtContent: null,
    clContent: null,
    caContent: null,
    bitDiameter: null,
    nozzleNumber: null,
    individualNozzleDiameter: null,
    bitSpeed: null,
    displacementBore: null,
    dischargeImpulseRate: null,
    riserPumpPressure: null,
    bitPressureDrop: null,
    annularPressureLoss: null,
    injectionVelocity: null,
    speedOfPipeReturn: null,
    bitWaterPower: null,
    specificWaterPower: null,
    oneMeterTime: null,
    realWeightOnBit: null,
    realtimeSpeed: null,
    actualDischarge: null,
    realtimePumpPressure: null,
    eCoordinate: null,
    nCoordinate: null,
    holeDriftAngle: null,
    azimuthAngle: null,
    fullAngularRateChange: null,
    rateOfDeviationChange: null,
    bearingRate: null,
    meanDiameter: null
  };
  proxy.resetForm("wellDetailDataRef");
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 新增按钮操作 */
function handleAdd() {
  reset();
  open.value = true;
  title.value = "添加钻井-详细信息";
}

/** 修改按钮操作 */
function handleUpdate(row) {
  loading.value = true
  reset();
  const _id = row.id || ids.value
  getWellDetailData(_id).then(response => {
    loading.value = false;
    form.value = response.data;
    open.value = true;
    title.value = "修改钻井-详细信息";
  });
}

/** 提交按钮 */
function submitForm() {
  proxy.$refs["wellDetailDataRef"].validate(valid => {
    if (valid) {
      buttonLoading.value = true;
      if (form.value.id != null) {
        updateWellDetailData(form.value).then(response => {
          proxy.$modal.msgSuccess("修改成功");
          open.value = false;
          getList();
        }).finally(() => {
          buttonLoading.value = false;
        });
      } else {
        addWellDetailData(form.value).then(response => {
          proxy.$modal.msgSuccess("新增成功");
          open.value = false;
          getList();
        }).finally(() => {
          buttonLoading.value = false;
        });
      }
    }
  });
}

/** 删除按钮操作 */
function handleDelete(row) {
  const _ids = row.id || ids.value;
  proxy.$modal.confirm('是否确认删除钻井-详细信息编号为"' + _ids + '"的数据项？').then(function() {
    loading.value = true;
    return delWellDetailData(_ids);
  }).then(() => {
    loading.value = true;
    getList();
    proxy.$modal.msgSuccess("删除成功");
  }).catch(() => {
  }).finally(() => {
    loading.value = false;
  });
}

/** 导出按钮操作 */
function handleExport() {
  proxy.download('helper/wellDetailData/export', {
    ...queryParams.value
  }, `wellDetailData_${new Date().getTime()}.xlsx`)
}
/** 导入按钮操作 */
function handleImport() {
  upload.title = "钻井数据导入";
  upload.open = true;
};
/** 下载模板操作 */
function importTemplate() {
  proxy.download("helper/wellDetailData/importTemplate", {
  }, `well_template_${new Date().getTime()}.xlsx`);
};
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
  upload.open = false;
  upload.isUploading = false;
  proxy.$refs["uploadRef"].handleRemove(file);
  proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
  getList();
};
/** 提交上传文件 */
function submitFileForm() {
  proxy.$refs["uploadRef"].submit();
};
getList();
</script>
